const state = {
  fields: [], // fields
  ForwardFields: []
};


const actions = {
  GetFields({ commit }, data) {
    let fields = [
      {
        title: '序号',
        dataIndex: 'id',
        align: 'center',
        width: 100
      },
      {
        title: '标题',
        dataIndex: 'title',
        align: 'center',
      },
      {
        title: '内容',
        dataIndex: 'content',
        align: 'center',
      },
      {
        title: '发布时间',
        dataIndex: 'create_time',
        align: 'center',
        // scopedSlots: { customRender: 'tag' },
      },
      {
        title: '操作',
        dataIndex: 'action',
        scopedSlots: { customRender: 'action' },
        align: 'center',
        width: 150,
      }
    ];
    commit('setfields', fields);
  },
  GetForwardFields({ commit }, data) {
    let fields = [
      {
        title: '序号',
        dataIndex: 'id',
        align: 'center',
        width: 100
      },
      {
        title: '头像',
        dataIndex: 'avatar',
        align: 'center',
        width: 100,
        scopedSlots: { customRender: 'avatar' },
      },
      {
        title: '用户名',
        dataIndex: 'username',
        align: 'center',
      },
      {
        title: '手机号',
        dataIndex: 'phone',
        align: 'center',
      },
      {
        title: '创建时间',
        dataIndex: 'create_time',
        align: 'center',
      },
      // {
      //   title: '操作',
      //   dataIndex: 'action',
      //   scopedSlots: { customRender: 'action' },
      //   align: 'center',
      //   width: 150,
      // }
    ];
    commit('setForwardfields', fields);
  },
};

const mutations = {
  // SetLists(state, lists) {
  //   state.List = lists;
  // },
  setfields(state, lists) {
    // console.log(state)
    state.fields = lists;
  },
  setForwardfields(state, lists) {
    // console.log(state)
    state.ForwardFields = lists;
  },
};

export default {
  namespaced: true,
  state,
  actions,
  mutations
};
